1. Field of the Invention
The present invention relates to a communication method performed by a communication apparatus connected to a network.
2. Description of the Related Art
An internet gateway device (IGD) having the Universal Plug and Play (UPnP) function is capable of performing port mapping (UPnP Forum http://www.upnp.org/). A relay apparatus performing port mapping adds a port mapping entry upon reception of AddPortMapping. The port mapping entry includes, for example, a destination port number of a packet received by the relay apparatus from an external network, and an IP address and a port number of a communication apparatus of a destination network. The relay apparatus relays the packet received from, for example, an external network to the communication apparatus of an internal network based on the port mapping information.
Japanese Patent Application Laid-Open No. 2005-346608 discusses a technique for deleting a port mapping entry by using DeletePortMapping when disconnecting a session of a device which has transmitted AddPortMapping. Japanese Patent Application Laid-Open No. 2004-328027 discusses a technique in which a relay apparatus configured to relay a packet based on port mapping deletes from a port mapping table an entry that remains unupdated for a predetermined time period.
However, there may be a situation of receiving an unintended packet depending on identification information used by the communication apparatus.
For example, a communication apparatus 1 having acquired an IP address 1 (internal address 1) of the internal network adds to the relay apparatus an entry having a destination port number of a packet from an external network, and the internal address 1 and a port number of a destination network. The internal address (local address) is an IP address used in the internal network.
Subsequently, the communication apparatus 1 may unintentionally terminate a session, for example, due to changes of communication environment. When the communication apparatus 1 terminates a session without deleting the entry by using DeletePortMapping and another communication apparatus 2 acquires the internal address 1 and starts communication, an unintended packet from an external network may be relayed to the communication apparatus 2.